package com.qwz.learn;

import com.qwz.example.colleague.Colleague;
import com.qwz.example.Mediator;

/**
* @Description: 具体的中介者实现
* @Package com.qwz.learn.ConcreteMediator
* @author Qiuwuzhi
* @date 2019/12/24 14:13
* @version V1.0
*/
public class ConcreteMediator implements Mediator {
    /**
     * 持有并维护同事A
     */
    private ConcreteColleagueA colleagueA;

    /**
     * 持有并维护同事B
     */
    private ConcreteColleagueB colleagueB;

    /**
     * 设置中介者需要了解并维护的同事A对象
     * @param colleagueA
     */
    public void setColleagueA(ConcreteColleagueA colleagueA) {
        this.colleagueA = colleagueA;
    }

    /**
     * 设置中介者需要了解并维护的同事B
     * @param colleagueB
     */
    public void setColleagueB(ConcreteColleagueB colleagueB) {
        this.colleagueB = colleagueB;
    }

    public void changed(Colleague colleague) {
        //某个同事类发生了变化，通常需要与其他同事交互
        //具体协调相应的同事对象来实现协作行为
    }
}
